# -*-coding:utf-8-*-
import sys
from sqlalchemy import Column, String, Integer, ForeignKey
from props.sql_connect import Base

reload(sys)

sys.setdefaultencoding('utf-8')


class book_tag_ref(Base):
    __tablename__ = 'book_tag_ref'
    __table_args__ = {'extend_existing': True}

    id = Column(Integer, primary_key=True)
    ref_book_id = Column(String(20), ForeignKey('doe_book.book_id'))
    ref_tag_title = Column(String(32))
    count = Column(Integer)

    def __init__(self, book, tag_name, count):
        self.ref_book_id = book
        self.ref_tag_title = tag_name
        self.count = count

    def __repr__(self):
        return '**REFER**' + self.ref_book_id + ':' + self.ref_tag_title + '_count:' + str(self.count)

